package com.huanuo.internetofthings.controller.jasper;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.unicorn.framework.core.ResponseDto;
import org.unicorn.framework.core.SysCode;
import org.unicorn.framework.core.exception.PendingException;

import com.huanuo.internetofthings.bo.jasperSimInfo.JasperSimInfo;
import com.huanuo.internetofthings.service.jasperSimInfo.JasperSimInfoService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * jasperSIM卡信息表 前端控制器
 * </p>
 *
 * @author xiebin
 * @since 2018-07-19
 */
@RestController
@RequestMapping("/jasperSimInfo")
@Api(value = "JASPER基础信息模块", tags = { "JASPER基础信息模块" })
public class JasperSimInfoController {
	@Autowired
    private JasperSimInfoService jasperSimInfoService;
	/**
	 * 
	 * @param iccid
	 * @return
	 * @throws PendingException
	 */
	@ApiOperation("查询设备sim卡情况")
	@RequestMapping(value = { "/info/{iccid}" }, method = { RequestMethod.GET })
	public ResponseDto<?> info(@PathVariable("iccid")String iccid) throws PendingException {
		if(StringUtils.isBlank(iccid)){
			throw new PendingException(SysCode.PARA_NULL,"iccid不能为空");
		}
		JasperSimInfo jasperSimInfo=new JasperSimInfo();
		jasperSimInfo.setIccid(iccid);
		return new ResponseDto<>(jasperSimInfoService.selectOne(jasperSimInfo));
	}
}
